// var o;
// exports.WelfareData = void 0;
// var $storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var s = {
//     inviteRecieved: [],
//     dailyShare: !1,
//     gameClubRecieved: !1,
//     subscribeRecieved: !1,
//     gameClubRecievedCount: 0
// };
// var c = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.inviteList = [];
//         t.inviteRule = null;
//         return t;
//     }
//     __extends(t, e);
//     t.getInstance = function () {
//         return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(t);
//     };
//     t.prototype.zhixing_chushihua_chuli = function () {
//         this.chushihua_cunchu_shuju(s);
//         this.chushihua_yuancheng_key(Object.keys(s));
//     };
//     t.prototype.jieshou_yaoqing_jiangli = function (e) {
//         if (-1 == this.inviteRecieved.indexOf(e)) {
//             this.inviteRecieved.push(e);
//             AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.REFRESH_INVITE_LIST);
//         }
//         this.shezhi_cunchu_shuju("inviteRecieved", this.inviteRecieved);
//     };
//     t.prototype.jieshou_youxiquan_jiangli = function () {
//         this.gameClubRecieved = !0;
//         this.gameClubRecievedCount++;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_GAME_CLUB_REFRESH);
//     };
//     t.prototype.huoqu_youxiquan_jieshou_jishu = function () {
//         return this.gameClubRecievedCount;
//     };
//     t.prototype.jieshou_meiri_fenxiang_jiangli = function () {
//         this.dailyShare = !0;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_DAILY_SHARE_REFRESH);
//     };
//     t.prototype.jieshou_dingyue_jiangli = function () {
//         this.subscribeRecieved = !0;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_SUBSCRIBE_REFRESH);
//     };
//     t.prototype.shuaxin_riqi_xianguan_shuju = function () {
//         this.dailyShare = !1;
//         this.gameClubRecieved = !1;
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_DAILY_SHARE_REFRESH);
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_GAME_CLUB_REFRESH);
//     };
//     t.prototype.chaxunYaoqingShuju = function () {
//         var e = this;
//         if (!(this.inviteList.length >= this.huoqu_yaoqing_guize()[this.huoqu_yaoqing_guize().length - 1])) {
//             ailin_sdk_manager.chaxunYaoqingShuju(function (t) {
//                 if (t) {
//                     e.inviteList = t;
//                     AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.REFRESH_INVITE_LIST);
//                 }
//             });
//         }
//     };
//     t.prototype.huoqu_shifou_yongyou_yaoqing_jiangli = function () {
//         if (this.inviteRecieved.length >= this.huoqu_yaoqing_guize().length) {
//             return !1;
//         }
//         var e = this.inviteList;
//         var t = this.huoqu_yaoqing_guize();
//         for (var n = 0; n < t.length; n++) {
//             var o = t[n];
//             if (e.length >= o && -1 == this.inviteRecieved.indexOf(n)) {
//                 return !0;
//             }
//         }
//         return !1;
//     };
//     t.prototype.huoqu_shifou_yongyou_fenxiang_jiangli = function () {
//         return !this.dailyShare;
//     };
//     t.prototype.huoqu_shifou_yongyou_youxiquan_jiangli = function () {
//         return !this.gameClubRecieved;
//     };
//     t.prototype.get_Have_Subscribe_Reward = function () {
//         return !this.subscribeRecieved;
//     };
//     t.prototype.huoqu_shifou_yongyou_renyi_fuli_jiangli = function () {
//         return (
//             this.huoqu_shifou_yongyou_yaoqing_jiangli() ||
//             this.huoqu_shifou_yongyou_fenxiang_jiangli() ||
//             this.huoqu_shifou_yongyou_youxiquan_jiangli() ||
//             this.get_Have_Subscribe_Reward()
//         );
//     };
//     t.prototype.huoqu_shifou_yi_jieshou_yaoqing_jiangli = function (e) {
//         return -1 != this.inviteRecieved.indexOf(e);
//     };
//     t.prototype.huoqu_suoyou_yaoqing_jiangli = function () {
//         return this.inviteRecieved.length >= this.huoqu_yaoqing_guize().length;
//     };
//     t.prototype.huoqu_yaoqing_guize = function () {
//         if (!this.inviteRule) {
//             this.inviteRule = [1, 3, 5];
//         }
//         return this.inviteRule;
//     };
//     t.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
//     t.key = "_wf";
//     return t;
// })($storageClass.AL_Framework_Storage_Class);
// exports.WelfareData = c;


/**
 * WelfareData - 通过反编译出来的代码，主要用于管理各种领取奖励的数据
 */
let storageClass;
exports.WelfareData = undefined;
const StorageClassModule = require("../../resources/scripts/AL_Framework_Storage_Class");
const Definitions = require("./AL_GAME_HUA_Define");

/** 初始化数据字段，记录邀请、分享等信息状态 */
const initialData = {
    inviteRecieved: [],
    dailyShare: false,
    gameClubRecieved: false,
    subscribeRecieved: false,
    gameClubRecievedCount: 0
};

/**
 * WelfareData类，继承自StorageClassModule，处理邀请、分享、订阅等操作。
 * 提供数据存储、共享信息获取、事件触发等功能。
 */
class WelfareData extends StorageClassModule.AL_Framework_Storage_Class {
    constructor() {
        super();
        /** 已收到的邀请列表 */
        this.inviteList = [];
        /** 邀请规则 */
        this.inviteRule = null;
    }

    /**
     * 获取WelfareData的单例对象
     */
    static getInstance() {
        return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(WelfareData);
    }

    /**
     * 初始化操作
     */
    zhixing_chushihua_chuli() {
        this.chushihua_cunchu_shuju(initialData);
        this.chushihua_yuancheng_key(Object.keys(initialData));
    }

    /**
     * 接收邀请奖励
     * @param {string} inviteId - 邀请的唯一标识符
     */
    jieshou_yaoqing_jiangli(inviteId) {
        if (this.inviteRecieved.indexOf(inviteId) === -1) {
            this.inviteRecieved.push(inviteId);
            AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.REFRESH_INVITE_LIST);
        }
        this.shezhi_cunchu_shuju("inviteRecieved", this.inviteRecieved);
    }

    /**
     * 接收游戏俱乐部奖
     */
    jieshou_youxiquan_jiangli() {
        this.gameClubRecieved = true;
        this.gameClubRecievedCount++;
        AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.ON_GAME_CLUB_REFRESH);
    }

    /**
     * 获取游戏俱乐部接收计数
     */
    huoqu_youxiquan_jieshou_jishu() {
        return this.gameClubRecievedCount;
    }

    /**
     * 接收每日分享奖励
     */
    jieshou_meiri_fenxiang_jiangli() {
        this.dailyShare = true;
        AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.ON_DAILY_SHARE_REFRESH);
    }

    /**
     * 接收订阅奖励
     */
    jieshou_dingyue_jiangli() {
        this.subscribeRecieved = true;
        AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.ON_SUBSCRIBE_REFRESH);
    }

    /**
     * 刷新日期，将每日分享和收到游戏俱乐部奖重置
     */
    shuaxin_riqi_xianguan_shuju() {
        this.dailyShare = false;
        this.gameClubRecieved = false;
        AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.ON_DAILY_SHARE_REFRESH);
        AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.ON_GAME_CLUB_REFRESH);
    }

    /**
     * 查询邀请数据
     */
    chaxunYaoqingShuju() {
        if (!(this.inviteList.length >= this.huoqu_yaoqing_guize()[this.huoqu_yaoqing_guize().length - 1])) {
            ailin_sdk_manager.chaxunYaoqingShuju((inviteData) => {
                if (inviteData) {
                    this.inviteList = inviteData;
                    AL_APP_SDK_MANAGER.emit(Definitions.GameEvent.REFRESH_INVITE_LIST);
                }
            });
        }
    }

    /**
     * 检查是否拥有邀请奖励
     */
    huoqu_shifou_yongyou_yaoqing_jiangli() {
        if (this.inviteRecieved.length >= this.huoqu_yaoqing_guize().length) {
            return false;
        }
        for (let i = 0; i < this.huoqu_yaoqing_guize().length; i++) {
            const rule = this.huoqu_yaoqing_guize()[i];
            if (this.inviteList.length >= rule && this.inviteRecieved.indexOf(i) === -1) {
                return true;
            }
        }
        return false;
    }

    /**
     * 检查是否拥有分享奖励
     */
    huoqu_shifou_yongyou_fenxiang_jiangli() {
        return !this.dailyShare;
    }

    /**
     * 检查是否拥有游戏俱乐部奖
     */
    huoqu_shifou_yongyou_youxiquan_jiangli() {
        return !this.gameClubRecieved;
    }

    /**
     * 检查是否拥有订阅奖励
     */
    get_Have_Subscribe_Reward() {
        return !this.subscribeRecieved;
    }

    /**
     * 检查是否拥有任意福利奖励
     */
    huoqu_shifou_yongyou_renyi_fuli_jiangli() {
        return (
            this.huoqu_shifou_yongyou_yaoqing_jiangli() ||
            this.huoqu_shifou_yongyou_fenxiang_jiangli() ||
            this.huoqu_shifou_yongyou_youxiquan_jiangli() ||
            this.get_Have_Subscribe_Reward()
        );
    }

    /**
     * 检查是否已经收到特定的邀请奖励
     * @param {string} inviteId - 邀请的唯一标识符
     */
    huoqu_shifou_yi_jieshou_yaoqing_jiangli(inviteId) {
        return this.inviteRecieved.indexOf(inviteId) !== -1;
    }

    /**
     * 检查是否已经收到所有邀请奖励
     */
    huoqu_suoyou_yaoqing_jiangli() {
        return this.inviteRecieved.length >= this.huoqu_yaoqing_guize().length;
    }

    /**
     * 获取邀请规则
     */
    huoqu_yaoqing_guize() {
        if (!this.inviteRule) {
            this.inviteRule = [1, 3, 5];
        }
        return this.inviteRule;
    }
}

/** 游戏名称 */
WelfareData.bundle = Definitions.Define.GAME_NAME;
/** 存储类关键字 */
WelfareData.key = "_wf";
exports.WelfareData = WelfareData;